﻿using UnityEngine;

namespace UnityEngine.UI
{
    /// <summary>
    /// 动态容器下的子节点，自动添加
    /// </summary>
    [DisallowMultipleComponent]
    public class UIDynamicItem : MonoBehaviour
    {
        //数据下标
        public int DataIndex;
        //item下标
        public int ItemIndex;

        private CanvasGroup _canvasGroup;

        public CanvasGroup GetCanvaGroup()
        {
            if (_canvasGroup == null)
            {
                _canvasGroup = gameObject.AddComponent<CanvasGroup>();
            }
            return _canvasGroup;
        }
    }
}